<template>
	<view :style="[{'font-weight':Style,'font-family':Font}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">绩效产量查询</view>
		</cu-custom>
		<!-- <sear-ch :placeholder="placeholder" @clean="clean" @input="input" @remove="remove" :message="message"></sear-ch> -->
		<!-- <screen-view ref="screen" @formSubmit="formSubmit" :isShow="false" :dateisShowyear="true"></screen-view> -->
		<view style="margin-bottom: 150rpx;">
			<view :class="[BackGroundBox,'cu-timeline']" v-for="(item,index) in deliverplan" :key="index">
				<view class="cu-time">{{item.NUM}}月</view>
				<view class="cu-item">
					<view class="content" @tap="jump(item)">
						<view class="margin-top grid text-center col-3">
							<view class="grid margin-bottom text-center col-1">
								<view class="bg-cyan2 padding-xs">总产量</view>
								<view class="cu-tag line-cyan">{{item.LSUMWEIGHT}}</view>
							</view>
							<view class="grid margin-bottom padding-left-sm text-center col-1">
								<view class="bg-green padding-xs">总工时</view>
								<view class="cu-tag line-green">{{item.LSUMTIME}}</view>
							</view>
							<view class="grid margin-bottom padding-left-sm text-center col-1">
								<view class="bg-red padding-xs">故障次数</view>
								<view class="cu-tag line-red">{{item.LSUMERROR}}</view>
							</view>
						</view>
						<view class="margin-top grid text-center col-3">
							<view class="grid margin-bottom text-center col-1">
								<view class="bg-blue padding-xs">故障处理时间</view>
								<view class="cu-tag line-blue">{{item.LERRORTIME}}</view>
							</view>
							<view class="grid margin-bottom padding-left-sm text-center col-1">
								<view class="bg-orange padding-xs">维修次数</view>
								<view class="cu-tag line-orange">{{item.LSUMREPAIR}}</view>
							</view>
							<view class="grid margin-bottom padding-left-sm text-center col-1">
								<view class="bg-grey padding-tb-xs" style="color: #fff;">维修处理时间</view>
								<view class="cu-tag line-grey">{{item.LREPAIRTIME}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<back-top v-if="isShow" @topClick="topClick">
			<image class="topimg" mode="aspectFit" src="https://www.ahlinghui.com/Uploads/image/20190429/images/BackTop.png"></image>
		</back-top>
		<view class="solid-top text-center col-1 bg-white" style="position: fixed;width: 100%;bottom: 0">
			<view class="bg-gray text-black text-bold padding-sm">总计</view>
			<view class="flex p-xs  mb-sm text-center">
				<view class="flex-sub padding-sm bg-cyan2">{{LSUMWEIGHT}}</view>
				<view class="flex-sub padding-sm bg-green">{{LSUMTIME}}</view>
				<view class="flex-sub padding-sm bg-red">{{LSUMERROR}}</view>
				<view class="flex-sub padding-sm bg-blue">{{LERRORTIME}}</view>
				<view class="flex-sub padding-sm bg-orange">{{LSUMREPAIR}}</view>
				<view class="flex-sub padding-sm bg-grey text-white">{{LREPAIRTIME}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import {
		inputSearch,
		scrollrefresh
	} from "@/mixin/mixin.js"
	import {
		getchievements
	} from "@/service/selectList.js"
	import SearCh from '@/colorui/components/search.nvue'
	import ScreenView from '@/colorui/components/ScreenView.vue'
	import BackTop from '@/colorui/components/BackTop.vue'
	export default {
		mixins: [inputSearch, scrollrefresh],
		data() {
			return {
				placeholder: '名称',
				message: '筛选',
				isShow: false,
				flag: true,
				LSUMWEIGHT:0,
				LSUMTIME:0,
				LSUMERROR:0,
				LERRORTIME:0,
				LSUMREPAIR:0,
				LREPAIRTIME:0,
				CustomBar: this.CustomBar,
				deliverplan: []
			}
		},
		computed: {
			...mapGetters(['Style', 'Font', 'BackGround', 'BackGroundBox'])
		},
		components: {
			SearCh,
			ScreenView,
			BackTop
		},
		onLoad() {
			getchievements(global.userinfo.lusercode,'2020','','',0).then(res => {
				if(res.code == 1) {
					res.data.forEach((value,index) => {
						this.LSUMWEIGHT = value.LSUMWEIGHT + this.LSUMWEIGHT
						this.LSUMTIME = value.LSUMTIME + this.LSUMTIME
						this.LSUMERROR = value.LSUMERROR + this.LSUMERROR
						this.LERRORTIME = value.LERRORTIME + this.LERRORTIME
						this.LSUMREPAIR = value.LSUMREPAIR + this.LSUMREPAIR
						this.LREPAIRTIME = value.LREPAIRTIME + this.LREPAIRTIME
					})
					this.LSUMWEIGHT = this.LSUMWEIGHT.toFixed(2)
					this.LSUMTIME = this.LSUMTIME.toFixed(2)
					this.LSUMERROR = this.LSUMERROR.toFixed(2)
					this.LERRORTIME = this.LERRORTIME.toFixed(2)
					this.LSUMREPAIR = this.LSUMREPAIR.toFixed(2)
					this.LREPAIRTIME = this.LREPAIRTIME.toFixed(2)
					this.deliverplan = res.data
				}
			})
		},
		methods: {
			jump(item) {
				uni.navigateTo({
					url: `./Performancequerydetail?yue=${item.NUM}`
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: whitesmoke;
	}

	.topimg {
		width: 100rpx;
		height: 100rpx;
	}
</style>
